﻿#region "Copyright (C) Lenny Granovsky. 2005-2013"
//This program is free software distribute under the terms of the GNU General Public License as published by
//the Free Software Foundation. Please read AssemblyInfo.cs file for more information.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Web.Enhancements.Rest
{
    /// <summary>
    /// <para>Attribute that allows to register route in the application route table.</para>
    /// <remarks>The information provided by this attributes is not inherited. Therefore all routes described in the base class will not be valid for inherited class and must be redefined.</remarks>
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
    public class RegisterRouteAttribute : System.Attribute
    {
        /// <summary>
        /// Gets or sets Method Name that route should be bound to. Use this value when route is declared at class level and should be bound to a method. 
        /// This is useful with inherited classes to describe routes for inherited methods.  
        /// </summary>
        public string BindToMethod { get; set; }
        /// <summary>
        /// Gets or sets the route.
        /// </summary>
        public string Route { get; set; }
        /// <summary>
        /// Gets or sets comma-delimited list of HTTP methods allowed to use the REST service method.
        /// </summary>
        public string LimitByHttpMethods { get; set; }

        /// <summary>
        /// Default class constructor.
        /// </summary>
        public RegisterRouteAttribute()
            : base()
        {
            this.Route = "";
            this.LimitByHttpMethods = "";
            this.BindToMethod = "";
        }
    }
}
